package com.ks.core.framework.cpsupload.demos.resp;

import java.util.Map;

// 微信支付响应组件
class WechatPayResponse extends AbstractResponseAdapter {
    public WechatPayResponse(Map<String, Object> rawData) {
        super("WECHAT", rawData);
    }
    
    @Override
    public String getCode() {
        return "SUCCESS".equals(rawData.get("return_code")) ? "SUCCESS" : "FAIL";
    }
    
    @Override
    public String getMessage() {
        return (String) rawData.getOrDefault("return_msg", "微信支付处理中");
    }
    
    @Override
    public Map<String, Object> getStandardData() {
        return Map.of(
            "transactionId", rawData.get("transaction_id"),
            "amount", extractAmount("total_fee"),
            "currency", "CNY",
            "paymentTime", rawData.get("time_end")
        );
    }
    
    @Override
    public String getOperationType() {
        return "PAYMENT";
    }
}